<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeBehind="Default.aspx.cs" Inherits="MOM.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>M.O.M - My Online Music</title>
	<script type="text/javascript" language="javascript" src="Js/jquery-1.2.6.js"></script>
	<script type="text/javascript" language="javascript" src="Js/jquery.flydom-3.1.0.js"></script>
	<script type="text/javascript" language="javascript" src="Js/jquery.accordion.js"></script>
	<script type="text/javascript" language="javascript" src="Js/jquery.contextmenu.r2.js"></script>
	<script type="text/javascript" language="javascript" src="Js/jquery-impromptu.1.5.js"></script>
    <script type="text/javascript" language="javascript" src="Js/Silverlight.js"></script>	
	<script type="text/javascript" language="javascript" src="Js/ufo.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Common.js"></script>	
	<script type="text/javascript" language="javascript" src="Js/Scroll.js"></script>
	<script type="text/javascript" language="javascript" src="Js/reflection.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Stargazer.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Toolbar.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Playlist.js"></script>
	<script type="text/javascript" language="javascript" src="Js/SharedPlaylist.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Mom.js"></script>
    <script type="text/javascript" language="javascript" src="Js/KeyHandler.js"></script>
    <script type="text/javascript" language="javascript" src="Player/CreatePlayer.js"></script>	
    <script type="text/javascript" language="javascript" src="Js/Translate_<%=Lang %>.js"></script>
	<script type="text/javascript">				
		var _PlayerDefined = false;
		
		$(document).ready(function() {
			createSilverlight();
			
			if ('<%#ListMode %>' == 'simple')
				document.getElementById("slctMode").options.selectedIndex = 1;	
		});
			
		function Player_Load()
		{
			if (!_PlayerDefined)
			{				
				$('#SubNav').accordion({header:'div.NavItem',alwaysOpen:false,active:false,animated:'slide',autoheight:false});
				$('#NowPlaying').contextMenu('NowPlayingMenu', 
				{
					bindings:
					{
						'lyrics':function() {window.MOM.GetLyrics();},
						'videos':function() {window.MOM.GetVideos();}
					},
					onShowMenu: function(e, menu) {
						$('#remove', menu).remove();
						$('#moveup', menu).remove();
						$('#movedown', menu).remove();
						return menu;
					}					
				});						
				window.Stargazer = new Stargazer();
				window.MOM = new MOM('<%=User.Identity.Name %>');
				window.MOM.Init('<%=MOMTheme %>');
				_PlayerDefined = true;
			}
		}
		
		function Player_Error(sender, errorArgs)
		{
		    alert(errorArgs.errorMessage);
			if (!_PlayerDefined)
			{
				alert("An error occured before the player was created. Make sure you have Silverlight 2.0 installed.");
			}
			else
			{
				$("#SilverlightError").css("display", "block").html(errorArgs.errorType + "<br/>" + errorArgs.errorMessage);
				setTimeout('$("#SilverlightError").css("display", "none")', 5000);
			}
		}
	</script>
	<style type="text/css">
		@import url(Css/Mom.css);
		@import url(Css/themes/<%=MOMTheme %>.css);
	</style>
</head>
<body ondragstart="return false;" ondrag="return false;">
	<form runat="server">
	<div id="NowPlayingMenu" class="contextMenu">
		<ul>
			<li id="moveup"><%=Translate("moveup") %></li>
			<li id="movedown"><%=Translate("movedown") %></li>
			<li id="lyrics"><%=Translate("lyrics") %></li>
			<li id="videos"><%=Translate("videos") %></li>
			<li id="remove"><%=Translate("remove") %></li>			
		</ul>
	</div>
	
	<div id="PlaylistMenu" class="contextMenu">
		<ul>
			<li id="delete"><%=Translate("delete") %></li>
		</ul>
	</div>
	
	<div id="Message" ondblclick="$(this).css('display','none').children().eq(0).empty();"><div id="MessageContent"></div></div>
	<div id="Backdrop" ondblclick="window.MOM.HideBackdrop();"></div>
	
	<div id="MOM">
		<div id="TopPanel" class="Row">		
			<div id="Nav">
				<div id="SubNav">
					<div id="NavLibraryBtn" onclick="$('#NavLibrary').slideToggle();"><%=Translate("library") %></div>
					<div id="NavLibrary">
						<a href="Browse.aspx?t=artist" target="frmLibrary" class="NavButton"><%=Translate("artists") %></a>
						<a href="Browse.aspx?t=album" target="frmLibrary" class="NavButton"><%=Translate("albums") %></a>
						<a href="Browse.aspx?t=track" target="frmLibrary" class="NavButton"><%=Translate("songs") %></a>
						<a href="Browse.aspx?t=genre" target="frmLibrary" class="NavButton"><%=Translate("genres") %></a>
						<a href="Browse.aspx?t=history" target="frmLibrary" class="NavButton"><%=Translate("history") %></a>
						<a href="Files.aspx" target="frmLibrary" class="NavButton">Files</a>						
					</div>
					<div>
						<div class="NavItem" id="NavNowPlaying" onclick="setTimeout('window.MOM.ScrollPlaylist()',1000);"><%=Translate("nowplaying") %></div>
						<div class="NavItemContent">
							<div id="PlayList"></div>
							<div class="Row">
								<a href="javascript:window.MOM.ClearPlaylist()" class="NavButton FloatLeft" style="width:90px;margin-right:1px;"><%=Translate("clear") %></a>
								<a href="javascript:window.MOM.SavePlaylist()" class="NavButton FloatLeft" style="width:89px;"><%=Translate("save") %></a>
							</div>
						</div>
					</div>
					<div>
						<div class="NavItem"><%=Translate("playlists") %></div>
						<div class="NavItemContent">
							<div id="PlayLists"></div>
							<a href="javascript:void(0)" onclick="window.MOM.SwitchSharedPlaylist(event);" class="NavButton" style="width:100%;margin-top:2px;"><%=Translate("switchshared") %></a>
						</div>
					</div>
					<div>
						<div class="NavItem"><%=Translate("bookmarks") %></div>
						<div class="NavItemContent">
						    <a class="NavButton" href="javascript:void(0);" onclick="$('#BookmarksInternal').slideToggle();"><%=Translate("bookmarksint") %></a>
						    <div id="BookmarksInternal" style="display:none;"></div>
						    <a class="NavButton" href="javascript:void(0);" onclick="$('#BookmarksExternal').slideToggle();"><%=Translate("bookmarksext") %></a>
						    <div id="BookmarksExternal" style="display:none;"></div>
							<a href="javascript:void(0)" class="NavButton" onclick="window.MOM.AddBookmark();" style="width:100%;margin-top:2px;"><%=Translate("addbookmark") %></a>							
						</div>
					</div>					
					<div>
						<div class="NavItem" id="NavSettings"><%=Translate("settings") %></div>
						<div class="NavItemContent">
							<div class="SettingsSection">
								<h2>LastFm</h2>	
								<div class="Row">
								<label for="txtLastFmUser" class="Settings"><%=Translate("user") %></label>
								<input type="text" id="txtLastFmUser" class="Settings" />
								</div>
								<div class="Row">
								<label for="txtLastFmPwd" class="Settings"><%=Translate("password") %></label>
								<input type="password" id="txtLastFmPwd" class="Settings" />
								</div>
								<div class="Row">
								<input type="checkbox" id="cbLastFm" />
								<label for="cbLastFm"><%=Translate("sendtolastfm") %></label>
								</div>
							</div>
							<div class="SettingsSection">
								<asp:Label ID="lblTheme" AssociatedControlID="ddlTheme" CssClass="Settings" runat="server"><%=Translate("theme") %></asp:Label>
								<asp:DropDownList ID="ddlTheme" runat="server"></asp:DropDownList>
							</div>
							<asp:PlaceHolder ID="plhAdmin" Visible='<%#IsAdmin %>' runat="server">
							<div class="SettingsSection">
								<a href="javascript:window.MOM.Sync()" class="NavButton" style="width:180px;margin-top:2px;"><%=Translate("synchronize") %></a>
								<a href="javascript:EditShares()" class="NavButton" style="width:180px;margin-top:2px;"><%=Translate("editshares") %></a>
								<a href="javascript:EditUsers()" class="NavButton" style="width:180px;margin-top:2px;margin-bottom:5px;"><%=Translate("editusers") %></a>
							</div>
							</asp:PlaceHolder>
							<a href="javascript:window.MOM.SaveSettings()" class="NavButton" style="width:190px;"><%=Translate("save") %></a>
						</div>
					</div>
				</div>
				<div id="SilverlightError"></div>
			</div>		
			<div class="FloatLeft">
				<div id="ToolBar" class="Row">
				    <div class="ToolBarItem">
				        <a href="http://www.momplay.net/help/?v=<%=System.Configuration.ConfigurationSettings.AppSettings["CurrentVersion"] %>" title="<%=Translate("help") %>" target="frmLibrary" style="display:block;margin-top:4px;"><img src="Images/<%=MOMTheme %>/help.png" border="0" /></a>
				    </div>
					<div class="ToolBarItem">					
						<input type="text" id="txtFilter" onkeydown="clearTimeout(_FilterTimer)" onkeyup="Filter(this.value)" onblur="Filter_Blur(this)" />
					</div>				
					<div class="ToolBarItem">
						<select id="slctMode" onchange="ModeChanged(this.options[this.options.selectedIndex].value)">
							<option value="full"><%=Translate("viewfull") %></option>
							<option value="simple"><%=Translate("viewlist") %></option>
						</select>
					</div>					
					<div class="ToolBarItem">
						<a href="javascript:window.Stargazer.View();" title="Stargaze"><img src="Images/<%=MOMTheme %>/stargazer.png" border="0" /></a>
					</div>					
					<div class="ToolBarItem">
						<a href="javascript:window.MOM.ViewNowPlaying()" title="<%=Translate("nowplaying") %>"><img src="Images/<%=MOMTheme %>/nowplaying.png" border="0" /></a>
					</div>					
					<div class="ToolBarItem">
						<a href="javascript:window.MOM.AddBookmark(window.frames['frmLibrary'].location, 2);" title="<%=Translate("createbookmark") %>"><img src="Images/<%=MOMTheme %>/addbookmark.png" border="0" /></a>
					</div>					
				</div>
				<div id="RightPanel">
					<iframe id="Library" width="100%" height="100%" src="Browse.aspx?t=artist" name="frmLibrary" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>
				</div>
			</div>
		</div>	
		<div id="BottomPanel">
			<div id="NowPlaying"></div>
			<div id="PlayerControlHost"></div>
		</div>
	</div>
	</form>
</body>
</html>